package homework12月9号补交.homework2.d4;

import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.util.List;

public class test {
    public static void main(String[] args) throws IOException,Exception {
        List<String> list = FileUtils.readLines(new File("D:\\ldea dashuju\\day.12.6\\src\\czxy\\homework2\\d4\\data.properties.properties"));
        Class<?> aClass = Class.forName("czxy.homework2.d4.User");
        for (String s : list) {
            String[] arr = s.split("=");
            Field f = aClass.getDeclaredField(arr[0]);
            f.setAccessible(true);
            Constructor<?> constructor = aClass.getConstructor();
            Object o = constructor.newInstance();
            f.set(o,arr[1]);
            Object o1 = f.get(o);
            System.out.println(o1);
        }
    }
}
